package com.test.p10proxy.dynnamic_jdk.example01;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class StarHandler implements InvocationHandler {

    Star realStar;

    public StarHandler(Star realStar) {
        this.realStar = realStar;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        Object object = null;
        System.out.println("######################");

        if("sing".equals(method.getName())){
            object = method.invoke(realStar,args);
        }
        return object;

    }

}
